/**
 * 公共组件统一导出
 * 用于全局注册或按需导入组件
 */

// 基础组件
export { default as BaseButton } from './BaseButton/index.vue'
export { default as BaseInput } from './BaseInput/index.vue'
export { default as BaseSelect } from './BaseSelect/index.vue'
export { default as BaseDialog } from './BaseDialog/index.vue'
export { default as BaseTable } from './BaseTable/index.vue'
export { default as BasePagination } from './BasePagination/index.vue'
export { default as BaseUpload } from './BaseUpload/index.vue'
export { default as BaseForm } from './BaseForm/index.vue'
export { default as BaseCard } from './BaseCard/index.vue'

// 业务组件
export { default as UserAvatar } from './UserAvatar/index.vue'
export { default as FilePreview } from './FilePreview/index.vue'
export { default as QrCodeScanner } from './QrCodeScanner/index.vue'
import ImageCropper from './ImageCropper/index.vue'
import SearchBar from './SearchBar/index.vue'
import StatusTag from './StatusTag/index.vue'
import EmptyState from './EmptyState/index.vue'
import BackTop from './BackTop/index.vue'

// 组件列表
const components = [
  BaseButton,
  BaseInput,
  BaseSelect,
  BaseDialog,
  BaseTable,
  BasePagination,
  BaseUpload,
  BaseForm,
  BaseCard,
  BaseLoading,
  UserAvatar,
  FilePreview,
  QrCodeScanner,
  ImageCropper,
  SearchBar,
  StatusTag,
  EmptyState,
  BackTop
]

/**
 * 全局注册组件
 * @param {Object} app - Vue应用实例
 */
export const installComponents = (app) => {
  components.forEach(component => {
    if (component.name) {
      app.component(component.name, component)
    }
  })
}

// 按需导出
export {
  BaseButton,
  BaseInput,
  BaseSelect,
  BaseDialog,
  BaseTable,
  BasePagination,
  BaseUpload,
  BaseForm,
  BaseCard,
  BaseLoading,
  UserAvatar,
  FilePreview,
  QrCodeScanner,
  ImageCropper,
  SearchBar,
  StatusTag,
  EmptyState,
  BackTop
}

// 默认导出
export default {
  install: installComponents
}